﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Drawing.Design;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.ComponentModel;
using System.Windows.Forms.Design;

namespace WCFLOBTalk.SalesForceWCF.Helpers
{
    public class PasswordUITypeEditor : UITypeEditor 
    {



        PasswordEditor ui;

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider sp, object value)
        {
            // get the editor service.
            IWindowsFormsEditorService edSvc =
            (IWindowsFormsEditorService)
         sp.GetService(typeof(IWindowsFormsEditorService));

           

            // create our UI
            if (ui == null)
            {
                ui = new PasswordEditor();
            }

           

            // instruct the editor service to display the control as a 
            // dropdown.
            edSvc.DropDownControl(ui);

            // return the updated value;
            return ui.Value;
        }

    }
}
